package com.cat.math;


/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/factorial-trailing-zeroes/
 * @create 2025/10/19 18:49
 * @since JDK17
 */

public class Solution19 {
    public int trailingZeroes(int n) {
        int ans = 0;
        for (int i = 2; i <= n; i++) {
            int x = i;
            while (x % 5 == 0) {
                x /= 5;
                ans++;
            }
        }

        return ans;
    }
}
